import static org.junit.Assert.*;

import java.awt.Color;

import game.Game;
import game.GameDriver;
import game.Round;

import org.junit.Before;
import org.junit.Test;

import player.Alien;
import player.Flapper;
import player.Human;
import player.Player;

import town.Store;

public class KevinTest {
    GameDriver driver;
    Game game;
    Round round;

    Player p1;
    Player p2;
    Player p3;
    Player p4;

    Store store;

    @Before
    public void setUp() {
	driver = new GameDriver();
	game = new Game(4, 1, 1);

	p1 = new Player(game, "bob", Color.RED, "red", new Flapper());
	p2 = new Player(game, "sally", Color.CYAN, "cyan", new Human());
	p3 = new Player(game, "dave", Color.GREEN, "green", new Human());
	p4 = new Player(game, "phil", Color.YELLOW, "yellow", new Alien());

	game.setPlayer(p1, 0);
	game.setPlayer(p2, 1);
	game.setPlayer(p3, 2);
	game.setPlayer(p4, 3);

	round = new Round(game, driver);
	store = new Store(game, driver, round);

    }

    @Test
    public void testResourceExchange() {
	round.incrementPlayerInt();

	System.out.println(round.getCurrPlayerResourceBasket());
	System.out.println(store.getResourceBasket());

//	assertTrue(store.sellResourceToStore(1, 3, 25));
	assertEquals(13, store.getResourceBasket().getResource(1));
	assertEquals(7, round.getCurrPlayerResource(1));
	assertEquals(525, round.getCurrPlayerResource(4));

//	assertTrue(store.sellResourceToStore(0, 8, 30));
	assertEquals(8, store.getResourceBasket().getResource(0));
	assertEquals(16, round.getCurrPlayerResource(0));
	assertEquals(285, round.getCurrPlayerResource(4));

//	assertFalse(store.sellResourceToStore(2, 1, 50));
	assertEquals(0, store.getResourceBasket().getResource(2));
	assertEquals(0, round.getCurrPlayerResource(2));
	assertEquals(285, round.getCurrPlayerResource(4));

    }
}
